package com.example.myyunpan.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.myyunpan.entity.domain.FileInfo;
import com.example.myyunpan.entity.domain.UserInfo;
import com.example.myyunpan.entity.query.FileInfoQuery;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.ArrayList;
import java.util.List;

/**
* @author 111
* @description 针对表【file_info(文件信息)】的数据库操作Mapper
* @createDate 2024-10-23 11:41:27
* @Entity com/example/myyunpan.domain.FileInfo
*/
@Mapper
public interface FileInfoMapper extends BaseMapper<FileInfo> {


    int selectCount(@Param("query") FileInfoQuery query);

    List<FileInfo> selectList(@Param("query") FileInfoQuery query);

    Long selectUseSpaceByUserId(String userId);

    FileInfo selectByFileIdAndUserIdFileInfo(@Param("fileId") String fileId, @Param("userId") String userId);

    void updateFileStatusWithOldStatus(@Param("fileId") String fileId,
                                       @Param("userId") String userId,
                                       @Param("bean") FileInfo t,
                                       @Param("oldStatus") Integer oldStatus);

    void updateByFileIdAndUserIdFileInfo(@Param("bean") FileInfo t,
                                         @Param("fileId") String fileId,
                                         @Param("userId") String userId);

    void updateFileDelFlagBatch(@Param("bean") FileInfo fileInfo,
                                @Param("userId") String userId,
                                @Param("filePidList") List<String> filePidList,
                                @Param("fileIdList") List<String> fileIdList,
                                @Param("oldDelFlag") Integer oldDelFlag);

    void delFileBatch(@Param("userId") String userId,
                      @Param("filePidList") List<String> filePidList,
                      @Param("fileIdList") List<String> fileIdList,
                      @Param("oldDelFlag") Integer oldDelFlag);

    Integer updateByUserId(@Param("bean") UserInfo t, @Param("userId") String userId);

    void deleteFileByUserId(String userId);

    Integer insertBatch(@Param("list") List<FileInfo> list);
}
